import { createWebHashHistory, createRouter } from "vue-router";
// 引入组件
import Home from "../views/Home/index.vue";
import Login from "../views/Login/index.vue";
import Layout from "../views/Layout/index.vue";
import Product from "../views/Product/index.vue";
// 配置路由规则
const routes = [
  { path: "/login", component: Login, name: "login" },
  {
    path: "/",
    component: Layout,
    children: [
      { path: "home", component: Home, name: "home" },
      { path: "product", component: Product, name: "product" },
    ],
  },
];
// 创建路由对象
const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
export default router;
